package com.caseProject.puremvc.command
{
	import com.caseProject.puremvc.model.ProjectProxy;
	import com.caseProject.puremvc.model.vo.ElementVO;
	import com.caseProject.puremvc.model.vo.PartitionVO;
	import com.caseProject.puremvc.model.vo.TransitionVO;
	import com.caseProject.puremvc.notifications.NotificationNames;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	public class ActionsGraphicCommand extends SimpleCommand
	{
		public function ActionsGraphicCommand()
		{
			super();
		}
		
		override public function execute(notification:INotification):void
		{
			var graphicVO:Object = notification.getBody() as Object;
			var projectProxy:ProjectProxy = this.facade.retrieveProxy(ProjectProxy.NAME) as ProjectProxy;
			
			switch (notification.getName())
			{
				case NotificationNames.GRAPHIC_DELETE_ELEMENT:
					projectProxy.deleteGraphicElement(graphicVO as ElementVO);
					break;
				case NotificationNames.GRAPHIC_DELETE_PARTITION:
					projectProxy.deleteGraphicPartition(graphicVO as PartitionVO);
					break;
				case NotificationNames.GRAPHIC_DELETE_TRANSITION:
					projectProxy.deleteGraphicTransition(graphicVO as TransitionVO);
					break;
				case NotificationNames.RETRIEVE_LINKED_TRANSITIONS:
					projectProxy.retrieveLinkedTransitions(graphicVO as ElementVO);
					break;
			}
		}
	}
}